package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.Buyrecord;
import cn.wolfcode.crm.mapper.BuyrecordMapper;
import cn.wolfcode.crm.qo.QueryObject;
import cn.wolfcode.crm.service.BuyrecordService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BuyrecordServiceImpl implements BuyrecordService {
    @Autowired
    private BuyrecordMapper buyrecordMapper;

    @Override
    public void insert(Buyrecord buyrecord) {
        buyrecordMapper.insert(buyrecord);
    }



    @Override
    public Buyrecord selectByPrimaryKey(Long id) {

        return buyrecordMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Buyrecord> selectAll() {
        return buyrecordMapper.selectAll();
    }


    @Override
    public void updateByPrimaryKey(Buyrecord buyrecord) {
        buyrecordMapper.updateByPrimaryKey(buyrecord);
    }

    @Override
    public PageInfo<Buyrecord> query(QueryObject qo) {
       //查询数据
        PageHelper.startPage(qo.getCurrentPage(),qo.getPagSize());

        return new PageInfo<>(buyrecordMapper.queryForList(qo));
    }

}
